import { GOODS_PENDING, GOODS_RESOLVE, GOODS_REJECT } from './../constants/goods';

const INITIAL_STATE = {
  goods:{
    // price: 0
  },
  pending: false
}

export default function goods(state = INITIAL_STATE, action) {
  switch(action.type) {
    case GOODS_PENDING:
      return {
        ...state,
        pending: true
      }
      break
    case GOODS_RESOLVE:
      return {
        ...state,
        goods: action.goods,
        pending: false
      }
      break
    case GOODS_REJECT:
      return {
        ...state,
        pending: false
      }
      break
    default:
      return state
      break
  }
}